Many applications make use of a database to store data used by the application. Such applications can be visualized as having an application layer on top of a database layer, in which the application layer provides the functionality of the application and the database layer persists the application data.
Some databases include stored procedure functionality, which allows both the retrieval and processing of data to be performed in the database. An application programmer determines whether a particular function should be performed in the application layer or in the database layer. Stored procedures often provide enhanced performance over similar application layer functionality, but can be more difficult to develop, test, and deploy.